<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/ajax-1.0.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery_last.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery-1.4.2.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery-impromptu.2.7.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery-selected.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.form.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.form.wizard.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.lazyload.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.treeview.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jQuery/jquery.validate.js"></script>
<title>Login Form</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<script type="text/javascript">
	$(document).ready(function() {
		$("#b01").click(function() {
		var user = $("#user").val();
		var psw = $("#psw").val();
		var url = "<%=request.getContextPath()%>/login.do?method=loginSingle&user="+user+"&psw="+psw;
		//url = encodeURI(url);
		alert("<%=request.getContextPath()%>/login.do?method=loginSingle&user="
													+ user + "&psw=" + psw);
											$
													.ajax({
														type : "post",
														url : url,
														datatype : "json",
														contentType : "application/x-www-form-urlencoded; charset=utf-8",
														success : function(data) {
															if (data == "1") {
																alert("登录成功");
															} else if(data == "2"){
																alert("重复登录");
																//location.href="index.jsp";
															}else{
															    alert("登录失败");
															}

														},
														error : function(
																XMLHttpRequest,
																textStatus,
																errorThrown) {
															alert(errorThrown);
														}
													});
										});
					});
					
					
					
					$(document).ready(function() {
		$("#b02").click(function() {
		var url = "<%=request.getContextPath()%>/login.do?method=loginOut";
											$.ajax({
														type : "post",
														url : url,
														datatype : "json",
														contentType : "application/x-www-form-urlencoded; charset=utf-8",
														success : function(data) {
															if (data == "1") {
																alert("注销成功");
																location.href="index.jsp";
															} else {
																alert("注销失败，已注销!");
																location.href="index.jsp";
															}

														},
														error : function(
																XMLHttpRequest,
																textStatus,
																errorThrown) {
															alert(errorThrown);
														}
													});
										});
					});
</script>
<body>
	
	<form id="saveAction" method="post" action="">
		
		<table>
			<tr>
				<td>姓名</td>
				<td><input id="user" name="user" type="text" /></td>
			</tr>
			<tr>
				<td>密码</td>
				<td><input id="psw" name="psw" type="text" /></td>
			</tr>
			<tr>
				<td colSpan="2" align="center"><input id="b01" type="button"
					value="提交" /> <input type="button" onclick="turnback()" value="返回" />
				</td>
			</tr>
		</table>
	</form>
	
	
	 <input id="b02" type="button"	value="注销" />
</body>
</html>
